package cn.janescott.inner.space.shiro.util;

//import cn.janescott.inner.space.lib.dto.BaseUserDTO;
import io.jsonwebtoken.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Scott on 2018/7/23
 */
public class JwtUtil {

//    public static String generateToken(BaseUserDTO userDTO) {
//        //获取DefaultJwtBuilder
//        JwtBuilder builder = Jwts.builder();
////        builder.set
//
////        builder.compact();
//        return null;
//    }
//
//    public static void main(String[] args) {
//
//        JwtBuilder builder = Jwts.builder();
////        builder.setPayload("{'name':'123','role':'admin'}");
//        Map<String, Object> claims = new HashMap<>();
//        claims.put("name", "scott");
//        claims.put("role", "admin");
//        builder.setClaims(claims);
////        builder.setPayload()
//        builder.signWith(SignatureAlgorithm.HS256, "123".getBytes());
//        String token = builder.compact();
//        System.out.println(builder);
//        System.out.println(token);
//        JwtParser parser = Jwts.parser();
////        Jwt parse = parser.setSigningKey("123".getBytes()).parseClaimsJws(token);
//        Jwt<Header, Claims> claimsJwt = parser.setSigningKey("123".getBytes()).parseClaimsJwt(token);
//        System.out.println(claimsJwt.getHeader());
////        System.out.println(parse.getBody());
////        System.out.println(parse.getHeader());
//    }

}
